home *** CD-ROM | disk | FTP | other *** search
/ Interactive Media Design Review 1999 / Interactive Media Design Review 1999.iso / pc / allfiles / Centri / Centri.dir / 00253_Script_Resizer < prev    next >
Text File  |  1999-02-25  |  2KB  |  57 lines

  1. property startBlend 
  2. property StartFadePoint 
  3. property EndFadePoint
  4.  
  5.  
  6. on beginSprite me -- sets initial blend
  7.   puppetsprite  the spriteNum of me, 1
  8.   set the stretch of sprite the spriteNum of me = TRUE
  9.   set the width of sprite the spriteNum of me = startBlend
  10.   set the height of sprite the spriteNum of me = startBlend
  11.   updatestage
  12. end
  13.  
  14. on exitFrame me -- provides the trigger for the blend updates
  15.   sendSprite  (the spritenum of me, #blendit)
  16. end
  17.  
  18.  
  19. on blendit me 
  20.   set dv = abs((the locV of sprite the spriteNum of me) - the mousev)
  21.   set  dH = abs((the locH of sprite the spriteNum of me) - the mouseh)
  22.   set distance = sqrt( dV * dV + dH * dH ) 
  23.   if distance < EndFadePoint then
  24.     set the width of sprite the spriteNum of me = startBlend -50
  25.   end if
  26.   if distance < StartFadePoint then
  27.     set percentage = (distance*100/StartFadePoint) 
  28.     set blendToValue =  (100-percentage)
  29.     if blendToValue < startBlend then set blendToValue =  startBlend -50
  30.     set the width of sprite the spriteNum of me = blendToValue 
  31.   else
  32.     set the width of sprite the spriteNum of me = startBlend -50
  33.   end if
  34.   if the width of sprite the spriteNum of me > 20 then
  35.     set the width of sprite the spriteNum of me = 20
  36.   else if the width of sprite the spriteNum of me < 15 then
  37.     set the width of sprite the spriteNum of me = 15
  38.   end if
  39.   set the height of sprite the spriteNum of me = the width of sprite the spriteNum of me
  40.   updatestage
  41. end
  42.  
  43. on getPropertyDescriptionList
  44.   set p_list = [¼
  45.                           #startBlend: [ #default:0, #format:#integer, #comment:"Initial Blend",#range: [#min:0,#Max:100]] ,¼
  46.                              #StartFadePoint: [ #default:10, #format:#integer, #comment:"Trigger Point", #range:[#min:0,#Max:500]],¼
  47.                              #EndFadePoint: [ #default:5, #format:#integer, #comment:"End Trigger Point", #range:[#min:0,#Max:50]] ¼
  48.                           ]
  49.   return p_list
  50. end
  51.  
  52.  
  53. on getBehaviorDescription
  54.   return  "Creates sprites that fade in and out (using the sprite blend property) depending how far they are from the mouse. " &return&return&¼
  55.                           "Try different inks for your sprites - different images require different settings. Also, there appears to be a bug in Director 6 that prevents sprites with a blend of 0 from being totally hidden. "
  56.   
  57. end